package com.zds.passwordbox.adapter;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

import java.util.List;

public class PageFragmentAdapter extends FragmentStateAdapter {

    List<Fragment> fragmentList;

    public PageFragmentAdapter(@NonNull FragmentActivity fragmentActivity, List<Fragment> fragmentList) {
        super(fragmentActivity);
        this.fragmentList = fragmentList;
    }

    @NonNull
    @Override
    public Fragment createFragment(int i) {
        return fragmentList.get(i);
//        switch (i) {
//            case 1:
//                return new AccountFragment();
//            case 2:
//                return new MineFragment();
//            default:
//                return new CodeFragment();
//        }
    }

    @Override
    public int getItemCount() {
        return fragmentList.size();
    }
}
